
/**
 * ARexxXmlException.h
 * @date {DATE}
 * @author
 */

#ifndef AREXXMLEXCEPTION_H
#define AREXXMLEXCEPTION_H

#include <exception>

#define COULDNTALLOCATEMEMORY 20
#define FILECOULDNTBEREAD   19
#define FILENOTFOUND        18
#define NOFILELOADED        17
#define INVALIDXML          16
#define UNKNOWNXMLENCODING  15
#define UNKNOWNDSTENCODING  14
#define ELEMENTNOTFOUND     5
#define NOXMLTAGINREQUEST   10
class ARexxXmlException : public std::exception {
  public:
    ARexxXmlException();
     ARexxXmlException(int i);

    int GetErrorCode() {
        return _what;
    }
    virtual const char* what() const throw()
    {
        switch(_what) {
            case COULDNTALLOCATEMEMORY:
                return "Couldn't allocate memory";
            case FILECOULDNTBEREAD:
                return "File couldn't be read";

            case FILENOTFOUND:
                return "File couldn't be found";

            case NOFILELOADED:
                return "No file was loaded";

            case INVALIDXML:
                return "Invalid XML";

            case ELEMENTNOTFOUND:
                return "Element couldn't be found";
            case NOXMLTAGINREQUEST:
                return "No element defined";
            default:
                return "Unknown exception";

        }
    }
  protected:
    int _what;
  private:

};
#endif


